package com.example.fqapp.room.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.example.fqapp.room.entity.EntityUser;

@Dao
public interface DaoUser {

    //插入用户
    @Insert
    long insert(EntityUser user);

    //删除用户
    @Delete
    int delete(EntityUser user);

    //删除用户通过 phoneNum
    @Query("DELETE FROM `user` WHERE phoneNum = :phoneNum")
    int deleteByPhoneNum(String phoneNum);

    //更新用户
    @Update
    int update(EntityUser user);

    //查询特定用户
    @Query("SELECT * FROM `user` WHERE phoneNum = :phoneNum")
    EntityUser getUserByPhoneNum(String phoneNum);
}
